Device Nominations
| |
Nomination Routine |
Description of Device |
| A |
gGlx() |
Default GLX Window |
| B |
gGlxw(pause,double,xp,yp,width,height) |
User-defined GLX Window |
| C |
gGlxao(window_id,pixmap_id) |
Opens GINO using an existing bitmap |
Device Characteristics
| Default Width |
2/3 Maximum |
User Defined |
Application Dependent |
| Default Height |
2/3 Maximum |
User Defined |
Application Dependent |
| Maximum Width |
Server Dependent |
| Maximum Height |
Server Dependent |
| Colour Palette |
True colour GLX visual |
| Drawing Modes |
GERASER, GNOT, GAND, GOR, GXOR |
| Character Sizes |
Server Dependent |
| Character Angles |
Server Dependent |
| Italic Characters |
Server Dependent |
| Polygonal Filling |
Single Polygons & Solid only |
| Image Handling |
All Functions |
| Cursor Types |
GHOURGLASS,GDEFAULT, GSMALLCROSS, GLARGECROSS, GCROSSHAIR, GX, GPOINTER  & 74 X specific types |
| Cursor Actions |
GPOLYLINE, GDEFAULT, GRUBBERBAND, GRUBBERBOX, GRUBBERSQUARE, GRUBBERELLIPSE, GRUBBERCIRCLE |
| Event Types |
GKEYPRESS, GLOCATOR, GMOVEMENT, GKEYRELEASE, GRESIZE, GPOINTERLEAVING, GPOINTERENTERING |
| Auxiliary Drawing Areas |
Yes (Up to 50 pairs) |
| Window/Device Titling |
Yes |
Driver Availability
The Glx driver is used for OpenGL applications under X-Windows.  It is therefore only available on Linux, UNIX and OpenVMS systems.
Using with F90
When using this driver with Fortran 90, a use statement is required at the start of the routine that makes the call to the device nomination routine as follows:
use glx_f90
Linking with GLX and Xlib Library
To satisfy all outstanding references made by this driver, the GL and XLIB libraries needs to be referenced in your link statement:
UNIX:
f90 -o myprog myprog.o -lgino-f90 -lGL -lGLU -lX11
Some UNIX systems may require extra libraries to satisfy further references from the X11 library. e.g. on Solaris:
f90 -o myprog myprog.o -lgino-f90 -lGL -lGLU -L/usr/openwin/lib -R/usr/openwin/lib -lX11 -lXext -lXmu
Device Nomination
Three nomination routines are available with GLX-windows:
gGlx()
This nomination routines opens a single buffered, standard window of 2/3 screen size in the top left-hand corner.
gGlxw(pause,double,xp,yp,width,height)
This routine allows the user to set the position, size and action at program termination where:
pause
|
= 0 |
specifies there is no pause at gCloseDevice() (default) |
|
= 1 |
specifies that the process will pause with a prompt at gCloseDevice() |
|
= 2 |
specifies that the process will pause (without prompt) at gCloseDevice() |
double
|
= 0 |
GINO creates and controls backing store ensuring all exposed areas are automatically repaired (default) |
|
= 1 |
An OpenGL double buffered visual is used which is often superior in performance but should only be used where the whole window is continually being redrawn by the application. |
xp,yp
specify the pixel position of the top left of the window (default = 0,0)
width,height
specify the pixel width and height of the window (default = 2/3 of max.)
The graphics window, however will always be cleared at the end of the program.
The nomination routine gGlx() is equivalent to calling gGlxw() as follows:
gGlxw(0,0,0,0,width,height)
where width,height are equivalent to two-thirds the dimensions of the full drawing area.
gGlxao(window_id,pixmap_id)
This routine allows GINO to draw to an existing window where window_id is the identifier of the external window and pixmap_id is the identifier of a pixmap the same size as the external window. If window_id or pixmap_id have a NULL value then they will be created by GINO.
The normal operation of the GLX-Windows driver is to open a window, map it, clear it and set up a colour table. A pixmap is also created to act as a backing store to enable the repainting of exposed regions.
When using gGlxao(), the window and pixmap are not created, but their attributes are obtained and used by GINO's initialization procedures. The window is not blanked and the colour map is not overwritten.
The window set up externally will need to be mapped before entering GINO.
If external drawing is to be used within the window, a pixmap will need to be created to allow damage repair on the window. To enable this all drawing must be done to the pixmap as well as to the window so that they are a copy of each other. Within the GINO gWaitForEvent()/gGetCursorEvent() loop, expose events on the window are trapped and used to trigger XCopyArea commands to repaint the window. If no external drawing is to be done, set pixmap_id to NULL and GINO will create and maintain the pixmap until gCloseDevice().
Single and Double Buffer Modes of operation
As can be seen above, GINO provides for two operational modes with its GLX driver.
I) Utilizing a GINO specific backing store (or pixmap)
ii) In OpenGL double buffered mode
The former works exactly the same as the XWIN driver which has the advantage of the user not worrying about expose events or iconization as these are dealt with by the driver, repairing and redrawing the appropriate areas from backing store. In this mode OpenGL is instructed to work in single buffered mode, drawing solely to the invisible backing store whilst GINO controls the copying of the backing store to the screen as appropriate to the GINO application.
Operating in OpenGL double buffered mode often provides a performance benefit, but at the expense of extra programming effort to cater for this mode of operation (see below). In this mode GINO draws to the OpenGL back buffer, and on a call to gFlushGraphics or gEndBatchUpdate, OpenGL swaps the contents of the front buffer (i.e. The screen) with that of the back buffer providing almost instantaneous updates of the image. However, according to the strict rules of OpenGL, after this update has been completed, the contents of the back buffer are undefined and so the whole picture has to be redrawn to the back buffer again ready for the next update.
Unfortunately, different implementations of OpenGL on X workstations and PC X emulators operate differently and do not always provide for the pixmap mode of operation. The table below shows these in summary:
| Environment |
Pixmap Mode |
Double Buffered Mode |
Back Buffer Lost |
| Exceed X-emulator |
Yes |
Yes |
Yes |
| MESA (Linux/OpenVMS) |
Yes |
Yes |
No |
By default the gGlx nomination routine will create a pixmap and OpenGL will work in single buffered mode except where such mode of operation is not possible. Fortunately in these cases, the OpenGL implementation automatically repairs exposed area (AIX) or the back buffer is not lost so GINO can carry out the repairs on an expose event (Solaris), so the extra programming effort normally required for double buffered modes is not needed.
Double buffered mode is available in all implementations of GINO and this can be selected by calling the gGlxw with double set to 1. This mode should only be used for animation type applications where the program is either in a hard loop where the window is continually being cleared (using gNewDrawing()) and a new image is being created, ending the loop with gFlushGraphics(). Alternatively, GINO events may be used, catering for key and mouse button presses to control the animation. GINO example programs 10 and 11 are cases in point. In this mode of operation the GLX driver causes an event type GRESIZE whenever an expose event occurs (see below for exceptions) allowing the application to redraw the complete contents of the window to repair the exposed area. Such an event should be added to the event list using gAddEventType() and programmed accordingly in any application that operates in double buffered mode. GINO example program 9 shows this type of application.
Where the contents of the back buffer are not lost after swapping the contents (AIX, MESA and SOLARIS), GINO will automatically repair areas after expose events and iconization and not generate the GRESIZE event, but if your application is to be machine independent the above guidelines should be followed.
Window & Pixmap Identifiers
The identifiers of the primary window and pixmap can be obtained though a special device driver dependent routine:
gGlxid(window_id, pixmap_id)
These values may be passed to an appropriate X routine requiring such information.
Window Size
If the user of the application changes the window size during operation, the driver will ensure that the picture is updated by redrawing from the backing store, but GINO is not able to take any further action until after a gNewDrawing() is called. At this point the programmer can re-enquire the window size using gEnqDrawingLimits() and take the appropriate action.
If the window size is changed by the user, this takes priority over the programmers request for a change through gSetDrawingLimits().
Window Title
The default window title of a GINO application is a string composed of the GINO version and license owner. This can be superceded in the following order of precedence:
1) GINO config variable GLXTITLE
2) System environment variable GLXTITLE
3) Application call to gSetDeviceTitle()
Colour Map
GINO will attempt to open a Double Buffered, RGBA GLX Visual providing true colour operation on the display. Most GLX extension will allow this even on 8 plane, indexed displays but the number of colours is obviously limited.
1024 entries in the GINO colour table are available to store colour definitions to use as colour indices.
On an 8 plane device, the GLX visual will attempt to share colours with the system colour map, possibly reducing the range of colours available for lighting. The user may choose to allocate a private colour map of 256 colours by setting the number of colours to 256 through one of the following methods:
1) Setting an environment variable GLXCOLS to 256
2) Calling the routine gSetColourInfo(ndc,ndt)
Graphics Visibility
The current graphics window can be popped to the front of the display or pushed to the back of the display using the GINO routine gSetGraphicsVis().
e.g.
gSetGraphicsVis(GINVISIBLE)
Pushes the window to the back
gSetGraphicsVis(GVISIBLE)
Pops the window to the front
Character Fonts
The following hardware character fonts are accessible through the routine gSetCharFont(font) or gSetCharFontName(fontname) where font or fontname can be one of the following:
| 0 or 100 |
Courier (default) |
The availability of the fonts is server dependent. The font enquiry routine gEnqHardFontList() can be used to enquire which fonts are available on the server being used. Where one of the hardware fonts listed above (except font 170) is not available a software emulation is provided with similar character proportions.
Bold and/or italic versions of fonts 100-106 can be selected using the routine gSetFontWeight(weight) where weight>0 and the routine gSetItalicAngle(angle) where angle is between 10 and 20 degrees.
Segment Facilities
The GLX driver supports some of GINO's segment facilities in line with the OpenGL Display List facilities. Thus the following segment routines operate through this driver:
| gOpenSeg() |
Open segment (nseg =  1>32676) |
Note that a segment must exist prior to making a reference to it using gInsertSegRef() and segments are always visible and hit sensitive.
N.B. As hardware fonts are stored internally as segments by the GLX driver, any change to the current character/font settings will close the currently opened segment. Therefore it is essential that the required character/font attributes are set before a GINO segment is opened and are not altered within a segment.
Mouse Pointer Types
When the window is first initialised the pointer icon is set to be an 'hour glass' indicating that no interaction can be performed. This is changed when either gGetCursorEvent() is called, or one of the permitted event types is enabled. The icon used at this point can be set using the routine:
gSetCursorType(type,forcol,bakcol)
where type is the type number. Type -1 is an hour-glass, type 0 is a double cross, type 1 is a single small cross and type 2 is a large cross extending the whole height and width of the window. The following additional X cursor types are also available.
 |
Additional X cursors |
forcol and bakcol can also be used to set the cursor foreground and background colour numbers, remembering that cursors are drawn in XOR mode resulting in a different appearance to the GINO colour numbers on the actual display.
Graphics Cursor
In addition to the usual key values returned for a cursor hit, some special values of key are also returned as follows:
| 0 |
A call to gGetCursorEvent() has been made when the graphics window is iconized |
| 1024 |
A resize event has taken place; the user should call gNewDrawing() and enquire the new size of the window (through gEnqDrawingLimits()) and redraw as required |
While waiting for a key or mouse button press, any expose events that take place will cause an automatic update of the exposed area from the backing store. When gGetCursorEvent() is called, the input focus of the device is set to be the graphics window. When the key has been pressed, the focus is returned to the window which had it before gGetCursorEvent() was called.
GLX Hard Copy
A GLX driver specific routine is available to create a PostScript image file from the contents of the current window:
gGlxeps(mode,filename,ier)
Where mode=0 to create a monochrome or =1 to create a colour image, filename is the name of the PostScript file to be created and ier returns 0 if it has been successfully created.
GLX Driver Error Messages
The following errors specific to this device driver may occur:-
At Initialization:
GINO ERROR 310 - Cannot Open Display
GLX Not Supported
No Conforming Visual
These messages are generated if the GLX driver cannot open the GLX extension library successfully, or that the display does not support any RGBA colour visual.
GINO ERROR 311 - Cannot Open Window
This is caused by an incorrect connection to the display or network problems. After outputting the error, the program will continue but no further output will take place.
At Initialization or gNewDrawing():
GINO ERROR 312 - Cannot obtain Window size
Character attribute setting:
GINO ERROR 313 - Cannot load required font
Iconized window at gCloseDevice():
GINO ERROR 314 - De-iconize Window